﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ReceiveDeposit.aspx.cs"
    Inherits="H2.NET.Web.Pages.SMD.ReceiveDeposit" %>

<%@ Import Namespace="System.Globalization" %>
<%@ Register Src="../../Controls/DwzAssessment.ascx" TagName="DwzAssessment" TagPrefix="uc" %>
<%@ Register Src="../../Controls/DwzAssessmentList.ascx" TagName="DwzAssessmentList" TagPrefix="uc" %>
<%@ Register Src="../../Controls/AjaxUpload.ascx" TagName="ajaxUpload" TagPrefix="uc" %>
<%@ Register Src="uc_store.ascx" TagName="uc_store" TagPrefix="uc" %>
<%@ Register Src="uc_search_store.ascx" TagName="uc_search_store" TagPrefix="uc" %>
<%@ Register Src="uc_head.ascx" TagName="uc_head" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />
<head id="Head1" runat="server">
    <title>Store Deposit Receive</title>
    <link href="<%=Page.ResolveUrl("~/Resource/Css/Style.css")%>" type="text/css" rel="stylesheet" />
    <link href="<%=Page.ResolveUrl("~/Resource/jBox/Blue/jbox.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=Page.ResolveUrl("~/Resource/Css/validform.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=Page.ResolveUrl("~/Resource/qtip/jquery.qtip.min.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=Page.ResolveUrl("~/Resource/Css/Pager.css")%>" rel="stylesheet" type="text/css" />
    <script src="<%=Page.ResolveUrl("~/Resource/dwz/js/jquery-1.7.2.min.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/Js/Common.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/Js/jquery.money.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/jBox/jquery.jBox-2.3.min.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/jBox/jquery.jBox-zh-CN.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/Js/Validform_v5.3.2.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/My97DatePicker/WdatePicker.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/qtip/jquery.qtip.min.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/Js/jquery.pager.js")%>" type="text/javascript"></script>
    <style type="text/css">
        .dialog_content
        {
            margin: 5px auto;
        }
        .dialog_content .dialog_head_search
        {
            margin-bottom: 5px;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            CheckDir($("#dir"));
            /* 初始化相关样式、表单验证提示 st */
            $("[datatype='*']").after("<em class='required'>*</em>");
            $("#form1").Validform({
                //提示信息将只会在表单提交时触发显示
                tipSweep: true,
                tiptype: function (msg, o, cssctl) {
                    //msg：提示信息;
                    //o:{obj:*,type:*,curform:*}, obj指向的是当前验证的表单元素（或表单对象），type指示提示的状态，值为1、2、3、4， 1：正在检测/提交数据，2：通过验证，3：验证失败，4：提示ignore状态, curform为当前form对象;
                    //cssctl:内置的提示信息样式控制函数，该函数需传入两个参数：显示提示信息的对象 和 当前提示的状态（既形参o中的type）;
                    if (o.type == 3) {
                        $.jBox.tip(msg, 'info');
                    }
                }
            });
            /* 初始化相关样式、表单验证提示 ed */

            /* 初始化控件提示 st */
            $.ajax({
                type: 'POST',
                url: '<%=Page.ResolveUrl("~/pages/smd/ajaxtools/handler.ashx?action=get_tips")%>',
                data: { pagename: 'transfer.aspx' },
                dataType: "json",
                cache: false,
                success: function (json) {
                    for (var o in json) {
                        var ControlID = json[o].ControlID;
                        var Content = json[o].Content;
                        $("#" + ControlID).qtip({
                            content: Content
                        });
                    }
                }
            });
            /* 初始化控件提示 ed */


            $(":text[name='store_authId']").addClass("search");
            // 双击选择门店之后跳转的url
            $("#return_url").val('<%=Page.ResolveUrl("~/pages/smd/ReceiveDeposit.aspx?TaskID=" + TaskAPI.TaskID)%>');
            // 控件设为只读
            $("#tbody_store input").attr("readonly", "readonly").addClass("readonly");


            //swidthDeposit($("#rbl_deposit_type :radio:checked"));
            // 保证金类型切换
            $("#rbl_deposit_type :radio").click(function () {
                swidthDeposit(this);
            });
            var step = "<%=TaskAPI.Step%>";
            var oldSubmit = $("#btn_submit").val();
            if (step == "Inform Delivery Device" || step == "Delivery Device") {
                $("[name='DwzAssessment1$RadOpition']").each(function () {
                    $(this).click(function () {
                        var value = $(this).val();
                        if (value == "1") {
                            $("#btn_submit").val("总部不发机(Submit)");
                        } else {
                            $("#btn_submit").val(oldSubmit);
                        }

                    });
                });
            }

        });
        $(function () {
            var step = "<%=TaskAPI.Step%>";
            if (step == "Submit Document") {
                $(".sapDevice").hide();
                $("#tr_deviceAmount").attr("colspan", "5");
                var istra = "<%=isTransfer%>";
                if (istra == "False") {
                    $("#tb_sb_postingDate").attr({ "datatype": "*", "nullmsg": "请填写汇款时间" });
                    $("#tb_sb_payer").attr({ "datatype": "*", "nullmsg": "请填写付款人" });
                }               
            }
            if (step == "Finance Confirm") {
                <% if (!_hasDevice)
                   { %>
                $("#DwzAssessment1_RadOpition").hide();
                <% } %>
                if (!$("#Agreement").css("display") == "none") {
                    $("#tb_zx_Amount").attr({ "datatype": "*", "nullmsg": "请选填写履约保证金金额" });
                }
                if (!$("#Device").css("display") == "none") {
                    $("#tb_sb_Amount").attr({ "datatype": "*", "nullmsg": "请选填写设备保证金金额" });
                }
            }
            else {
                if (!$("#Device").css("display") == "none") {
                    $("#tb_sb_Amount").attr({ "datatype": "*", "nullmsg": "请选填写设备保证金金额" });
                }
            }
        });

        /* 打开选择门店窗体 st */
        function openStoreDialog(obj) {
            if ($(obj).hasClass("search")) {
                $.jBox("id:uc_search_store_td", {
                    title: "双击选择门店",
                    width: 650,
                    height: 500,
                    buttons: {}
                });
            }
        }
        /* 打开选择门店窗体 ed */

        /* 提交表单 st */
        function confirmSubmit() {
            var step = "<%=TaskAPI.Step%>";
            var DeliveryType = "";
            $("[name='DeliveryType']").each(function () {
                if ($(this).attr("checked") == "checked") {
                    DeliveryType = $(this).val();
                }
            });


            if (DeliveryType == "" && step == "Delivery Device") {
                var option = "";
                $("[name='DwzAssessment1$RadOpition']").each(function () {
                    if ($(this).attr("checked") == "checked") {
                        option = $(this).val();
                    }
                });
                if (option != "1") {
                    $.jBox.tip('请选择装修方式！', '提示');
                    return false;
                }

            }

            if (step == "Delivery Device" || step == "Inform Delivery Device") {
                var option = "";
                $("[name='DwzAssessment1$RadOpition']").each(function () {
                    if ($(this).attr("checked") == "checked") {
                        option = $(this).val();
                    }
                });

                if (option == "") {

                }
            }

            if (window.confirm("确认要提交吗？")) {
                $.jBox.tip('正在处理，请稍等...', 'loading');
                return true;
            }

            return false;
        }
        /* 提交表单 ed */

        /* 设置设备ID */
        function setCkDevice(arg) {
            $("#hidDeviceID").val($(arg).val());
        }


        function openMPNoDialog(obj) {
            setTimeout(function () {
                MphSearch(1);
            }, 100);

            if ($(obj).hasClass("search")) {
                $.jBox("id:search_mpno", {
                    title: "双击选择美萍号",
                    width: 380,
                    height: 500,
                    buttons: {}
                });
            }
        }

        function openDeviceNoDialog(obj) {
            DeviceSearch(1);
            $.jBox("id:search_deviceno", {
                title: "双击选择设备号",
                width: 1000,
                height: 500,
                buttons: {}
            });
        }

        function chooseUpdateDevice(obj) {
            if ($(obj).attr("checked") == "checked") {
                $("#btn_choose").show();
                $("#oldDevieSN").show();
            }
            else {
                $("#btn_choose").hide();
                $("#oldDevieSN").html("");
                $("#h_deviceId").val("0");
            }
        }

        function CheckDir(dir) {
            if ($(dir).attr("checked") == "checked") {
                $("#dirRemark").show();
            } else {
                $("#dirRemark").hide();
            }

        }

        function doGDZCH(obj) {
            $.ajax({
                type: 'POST',
                url: '<%=Page.ResolveUrl("~/pages/smd/ajaxtools/handler.ashx")%>',
                data: { action: "getFullSet",
                    DeliveryType: obj,
                },
                cache: false,
                success: function (result) {
                    $("#fullSetSN").val(result);
                }
            });
        }

        function doSCCKD() {
            var DeliveryType = "";
            $("[name='DeliveryType']").each(function () {
                if ($(this).attr("checked") == "checked") {
                    DeliveryType = $(this).val();
                }
            });
            if (DeliveryType == "") {
                alert("请选择发放方式！");
                return false;
            }
            $.ajax({
                type: 'POST',
                url: '<%=Page.ResolveUrl("~/pages/smd/ReceiveDeposit.aspx")%>',
                data: {
                    action: "CKD",
                    storeId: '<%=Storeid %>',
                    process: '<%=TaskAPI.Process %>',
                    incident: '<%=TaskAPI.Incident.ToString(CultureInfo.InvariantCulture) %>',
                    PcModel: $("#l_PcModel").html(),
                    ShakerModel: $("#l_ShakerModel").html(),
                    DispenseModel: $("#l_DispenseModel").html(),
                    Address: $("#tb_address").val(),
                    ContactNumber: $("#tb_ContactNumber").val(),
                    Contacts: $("#tb_Contacts").val(),
                    PurchasedDate: $("#PurchasedDate").val(),
                    DealerName: $("#uc_store1_dealer_name_label").html(),
                    quanTao: $("#dir").attr("checked"),
                    DeliveryType: DeliveryType
                },
                cache: false,
                success: function (result) {
                    var json = eval(result);
                    var html = "";
                    var ships = json.navTabId.split("*");
                    for (var i = 0; i < ships.length; i++) {
                        var ckds = ships[i].split("|");
                        if (ckds[0] != "") {
                            html += ckds[0] + "出库单：<a class='u-btn' style='margin-right:20px' onclick=\"downCKD('" + ckds[1] + "')\">下载</a>";
                        }
                    }

                    $("#td_ckdList").html(html);
                }
            });
        }

        function downCKD(obj) {
            window.location.href = '<%=Page.ResolveUrl("~/pages/smd/ReceiveDeposit.aspx?action=downCKD&FileName=")%>' + obj;
        }

    </script>
</head>
<body>
    <div class="flowpage">
        <form id="form1" runat="server">
        <!-- 标题 st -->
        <uc1:uc_head ID="uc_head1" runat="server" />
        <!-- 标题 ed -->
        <!-- 表单内容 st -->
        <div style="margin: 10px 0;">
            <table class="formTable">
                <!-- 门店信息 st -->
                <uc:uc_store ID="uc_store1" runat="server" />
                <!-- 门店信息 ed -->
                <!-- 设备信息 st -->
                <tr id="tr_DeviceTitle" runat="server">
                    <th class="title" colspan="6">
                        设备信息
                    </th>
                </tr>
                <tr id="tr_threeMode" runat="server">
                    <th>
                        调色机型号：
                    </th>
                    <td>
                        <asp:DropDownList ID="DispenseModel" runat="server">
                            <asp:ListItem Value="" Text="==请选择=="></asp:ListItem>
                        </asp:DropDownList>
                        <asp:Label ID="l_DispenseModel" runat="server"></asp:Label>
                    </td>
                    <th>
                        震荡机型号：
                    </th>
                    <td>
                        <asp:DropDownList ID="ShakerModel" runat="server">
                            <asp:ListItem Value="" Text="==请选择=="></asp:ListItem>
                        </asp:DropDownList>
                        <asp:Label ID="l_ShakerModel" runat="server"></asp:Label>
                    </td>
                    <th>
                        电脑型号：
                    </th>
                    <td>
                        <asp:DropDownList ID="PcModel" runat="server">
                            <asp:ListItem Value="" Text="==请选择=="></asp:ListItem>
                        </asp:DropDownList>
                        <asp:Label ID="l_PcModel" runat="server"></asp:Label>
                    </td>
                </tr>
                <tbody id="tb_Inform_Device" runat="server">
                    <tr>
                        <th>
                            联系人：
                        </th>
                        <td>
                            <asp:TextBox ID="tb_Contacts" runat="server"></asp:TextBox>
                            <asp:Label ID="l_Contacts" runat="server"></asp:Label>
                        </td>
                        <th>
                            联系电话：
                        </th>
                        <td>
                            <asp:TextBox ID="tb_ContactNumber" runat="server" class="phone"></asp:TextBox>
                            <asp:Label ID="l_ContactNumber" runat="server"></asp:Label>
                        </td>
                        <th><B style="color:red;">DIR仅电脑</B></th>
                        <td>
                            <input type="checkbox" name="dir" id="dir" runat="server"/>
                        </td>
                    </tr>
                </tbody>
                <tbody id="tb_Delivery_Device" runat="server">
                    <tr>
                        <th>
                            发放方式：
                        </th>
                        <td>
                            <%if (DeliveryType != null)
                              {
                                  for (int i = 0; i < DeliveryType.Rows.Count; i++)
                                  {%>
                            <input type="radio" id="DeliveryType_<%:i%>" name="DeliveryType" value="<%=DeliveryType.Rows[i]["name"]%>"
                                onclick="doGDZCH('<%=DeliveryType.Rows[i]["name"]%>')" />
                            <label for="DeliveryType_<%:i%>">
                                <%=DeliveryType.Rows[i]["name"]%></label>
                            <%}
                              }%>
                            <asp:Label ID="l_DeliveryType" runat="server"></asp:Label>
                        </td>
                        <th>
                            设备固定资产号：
                        </th>
                        <td>
                            <input type="text" readonly="readonly" class="required" id="fullSetSN" runat="server" />
                            <asp:Label ID="l_FullSetSN" runat="server"></asp:Label>
                        </td>
                        <th>
                            美萍号：
                        </th>
                        <td>
                            <input type="text" style="width: 99%" readonly="readonly" value="" onclick="openMPNoDialog(this)"
                                class="search" id="meiPinNo" runat="server" />
                            <asp:Label ID="l_meiPinNo" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            发机年份：
                        </th>
                        <td>
                            <asp:TextBox ID="PurchasedDate" runat="server" CssClass="Wdate" onfocus="WdatePicker({dateFmt:'yyyy'})"></asp:TextBox>
                            <asp:Label ID="l_PurchasedDate" runat="server"></asp:Label>
                        </td>
                        <th>
                            设备是否更新：
                        </th>
                        <td colspan="3">
                            <input type="checkbox" onclick="chooseUpdateDevice(this)" id="cb_needUpdate" runat="server" />
                            <input id="btn_choose" type="button" class="u-btn" onclick="openDeviceNoDialog(this)"
                                style="display: none" value="需更新设备选择" />
                            <span id="oldDevieSN" runat="server"></span>
                            <input type="hidden" id="h_deviceId" runat="server" />
                        </td>
                    </tr>
                </tbody>
                <tr id="tr_address" runat="server">
                    <th>
                        设备发往地址：
                    </th>
                    <td colspan="5">
                        <asp:TextBox ID="tb_address" runat="server" Style="width: 80%"></asp:TextBox>
                        <asp:Label ID="l_address" runat="server"></asp:Label>
                    </td>
                </tr>
                <!-- 设备信息 ed -->
                <tbody id="CKD_list" runat="server">
                    <tr>
                        <td class="title" colspan="6">
                            出库单列表
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="button" class="u-btn" onclick="doSCCKD()" id="ckd_btn" runat="server"
                                value="生成出库单" />
                        </td>
                        <td colspan="5">
                            <label style="color: Red">
                                发邮件：<input type="checkbox" id="isSendEmail" runat="server" /></label>
                            <label id="td_ckdList" style="padding-left: 50px" runat="server">
                            </label>
                        </td>
                    </tr>
                </tbody>
                <tbody>
                    <tr>
                        <td class="title" colspan="6">
                            保证金收取  <span style="color:red"><%:isTransfer?"(如果旧机转让或者转移无须上传汇款底单)":"" %></span>
                        </td>
                    </tr>
                </tbody>
                <tbody id="Agreement" runat="server">
                    <tr>
                        <th>
                            履约保证金金额：
                        </th>
                        <td colspan="5">
                            <asp:TextBox ID="tb_zx_Amount" runat="server" CssClass="ci required"></asp:TextBox>
                            <asp:Literal ID="l_zx_Amount" runat="server"></asp:Literal>
                            <asp:Label ID="l_fullAmount" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr id="AgreementManager" runat="server" style="display: none;">
                        <th>
                            入账日期：
                        </th>
                        <td>
                            <asp:TextBox ID="tb_zx_postingDate" runat="server" ReadOnly="true" CssClass="Wdate required"
                                onfocus="WdatePicker()"></asp:TextBox>
                            <asp:Literal ID="l_zx_postingDate" runat="server"></asp:Literal>
                        </td>
                        <th>
                            付款人：
                        </th>
                        <td colspan="3">
                            <asp:TextBox ID="tb_zx_payer" runat="server" CssClass="required"></asp:TextBox>
                            <asp:Literal ID="l_zx_payer" runat="server"></asp:Literal>
                        </td>
                    </tr>
                </tbody>
                <!--装修信息 st-->
                <tbody id="hidRenovation" style="display: none" runat="server">
                    <tr>
                        <th>
                            <span style="color: #FF3366">装修方式：</span>
                        </th>
                        <td colspan="5">
                            <%if (RencovationType != null)
                              {
                                  for (int i = 0; i < RencovationType.Rows.Count; i++)
                                  {%>
                            <input type="radio" id="RenvotionType_<%:i%>" name="RenvotionType" value="<%=RencovationType.Rows[i]["name"]%>" />
                            <label for="RenvotionType_<%:i%>">
                                <%=RencovationType.Rows[i]["name"]%></label>
                            <%}
                              }%>
                            <asp:Label ID="l_RenovationType" runat="server"></asp:Label>
                        </td>
                    </tr>
                </tbody>
                <!--装修信息 ed-->
                <tbody id="Device" runat="server">
                    <tr>
                        <th>
                            设备保证金金额：
                        </th>
                        <td id="tr_deviceAmount">
                            <asp:TextBox ID="tb_sb_Amount" runat="server" CssClass="ci required"></asp:TextBox>
                            <asp:Literal ID="l_sb_Amount" runat="server"></asp:Literal>
                        </td>
                        <th class="sapDevice">
                            SAP Document Number：
                        </th>
                        <td class="sapDevice" colspan="3">
                            <asp:TextBox ID="tb_SapDeviceNo" runat="server" CssClass="required"></asp:TextBox>
                            <asp:Label ID="l_SapDeviceNo" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            购机款总额：
                        </th>
                        <td>
                            <asp:TextBox ID="tb_BuyMachineDeposit" runat="server" class="ci"></asp:TextBox>
                            <asp:Literal ID="l_BuyMachineDeposit" runat="server"></asp:Literal>
                        </td>
                        <th>
                            系统流水号：
                        </th>
                        <td colspan="3">
                            <asp:TextBox ID="tb_EapproveSN" runat="server"></asp:TextBox>
                            <asp:Literal ID="l_EapproveSN" runat="server"></asp:Literal>
                        </td>
                    </tr>
                    <tr id="deviceManager" runat="server">
                        <th>
                            汇款时间：
                        </th>
                        <td>
                            <asp:TextBox ID="tb_sb_postingDate" runat="server" CssClass="Wdate required" onfocus="WdatePicker()"></asp:TextBox>
                            <asp:Literal ID="l_sb_postingDate" runat="server"></asp:Literal>
                        </td>
                        <th>
                            付款人：
                        </th>
                        <td colspan="3">
                            <asp:TextBox ID="tb_sb_payer" runat="server" CssClass="required"></asp:TextBox>
                            <asp:Literal ID="l_sb_payer" runat="server"></asp:Literal>
                        </td>
                    </tr>
                </tbody>
                <!--设备列表-->
                <tbody id="DeliveryDevice" style="display: none" runat="server">
                </tbody>
                <tbody id="tb_fj" runat="server">
                    <tr>
                        <th>
                            上传汇款底单：
                        </th>
                        <td colspan="5">
                            <uc:ajaxUpload ID="ajaxUpload1" runat="server" />
                        </td>
                    </tr>
                </tbody>
                <!-- 审批列表 st -->
                <tbody id="assessment" runat="server" visible="false">
                    <tr>
                        <td class="title" colspan="6">
                            审批列表
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6">
                            <uc:DwzAssessmentList ID="DwzAssessmentList1" runat="server" />
                        </td>
                    </tr>
                </tbody>
                <!-- 审批列表 ed -->
                <!-- 审批意见 st -->
                <tbody>
                    <uc:DwzAssessment ID="DwzAssessment1" runat="server" />
                </tbody>
                <!-- 审批意见 ed -->
            </table>
            <%  if (H2.NET.Common.AksRequest.GetString("showbtn") != "0")
                { %>
            <div style="margin: 5px; padding-bottom: 10px; text-align: center;">
                <asp:Button ID="btn_submit" runat="server" CssClass="u-btn" Text="提交(Submit)" OnClick="btn_submit_Click"
                    OnClientClick="return confirmSubmit();"  />
                <input type="button" class="u-btn u-btn-c4" value="关闭(Close)" onclick="custom_close()" />
                <asp:HyperLink ID="hl_ExportPdf" runat="server" Visible="false" Target="_blank" CssClass="u-btn u-btn-c3"
                    Style="height: 28px; line-height: 28px; display: inline-block;">生成(PDF)</asp:HyperLink>
                <asp:Button ID="btn_print" runat="server" CssClass="u-btn u-btn-c2" Text="打印(Print)"
                    OnClientClick="window.print()" Visible="false" />
            </div>
            <%  } %>
        </div>
        <!-- 表单内容 ed -->
        </form>
    </div>
    <div id="search_store" style="display: none;">
        <uc:uc_search_store ID="uc_search_store1" runat="server" />
    </div>
    <script type="text/javascript">
        var MphSearch = function searchMPH(pageclickednumber) {
            $.ajax({
                type: 'POST',
                url: '<%=Page.ResolveUrl("~/pages/smd/ajaxtools/handler.ashx")%>',
                data: { action: 'search_mp',
                    storeid: '<%=SeachStoreId %>',
                    keywords: $.jBox.getBox().find(":text[name='mphName']").val(),
                    pageNumber:pageclickednumber,
                    pageSize:14},
                beforeSend: function () {
                    $.jBox.getBox().find("#btn_mph_search").val("加载中...");
                },
                complete: function () {
                    $.jBox.getBox().find("#btn_mph_search").val("检索");
                },
                success: function (result) {
                    
                    $("#jbox-content #pager").pager({ pagenumber: pageclickednumber, pagecount: result.pageNum, buttonClickCallback:MphSearch });
                    var data = result.data;
                    var html = "";
                    for(var o in data){
                        html += "<tr mph='"+data[o].SerialNumber+"'>";
                        html += " <td align=center>" + data[o].SerialNumber + "</td>";
                        html += "</tr>";
                    }

                    $.jBox.getBox().find("#dialog_mph_tbody").html(html);

                    $.jBox.getBox().find("#dialog_mph_tbody tr").dblclick(function () {
                        $("#meiPinNo").val($(this).attr("mph"));
                        $.jBox.close();
                    });
                }
            });
        }

            var DeviceSearch =function searchDevice(pageclickednumber) {
                $.ajax({
                    type: 'POST',
                    url: '<%=Page.ResolveUrl("~/pages/smd/ReceiveDeposit.aspx")%>',
                data: { action: 'chooseDevice',
                    storeid: <%=SeachStoreId %>,
                    keywords: $.jBox.getBox().find(":text[name='deviceName']").val()    },
                beforeSend: function () {
                    $.jBox.getBox().find("#btn_device_search").val("加载中...");
                },
                complete: function () {
                    $.jBox.getBox().find("#btn_device_search").val("检索");
                },
                success: function (result) {
                    var key = $.jBox.getBox().find(":text[name='deviceName']").val();
                    $.jBox.getBox().find("#btn_device_search").val("检索");
                    result = $.parseJSON(result);
                    var html = "";
                    if (result == null) {
                        if(key != "")
                            $.jBox.getBox().find("#dialog_device_tbody").html(
                                "<tr><td colspan='9' style='text-align: center;'>该门店目前还没有设备。</td></tr>");

                        return;
                    }
                    var rst = result.navTabId.split("|");
                    for (var i = 0; i < rst.length; i++) {
                        if (rst[i]) {
                            var list = rst[i].split(",");
                            var html = "";
                            if (list.length > 0) {
                                var deviceAll = "<td>" + list[3] + "</td>";
                                deviceAll += "<td>" + list[4] + "</td>";
                                deviceAll += "<td>" + list[5] + "</td>";
                                html += "<tr deviceId='" + list[0] + "' fullsn = " + list[1] + " meiping = " + list[2] + " deviceALL='" + deviceAll + "'>";
                                for (var j = 1; j < list.length; j++) {
                                    html += "<td style='text-align:center'>" + list[j] + "</td>";
                                }
                                html += "</tr>";
                                $.jBox.getBox().find("#dialog_device_tbody").html(html);
                            }
                        }
                    }
                    

                    $.jBox.getBox().find("#dialog_device_tbody tr").click(function () {
                        if($(this).attr("deviceId") != null){
                            $("#deviceInfo").html($(this).attr("deviceALL"));
                            $("#oldDevieSN").html("      固定资产号："+$(this).attr("fullsn")+"的设备将被更新");
                            $("#h_deviceId").val($(this).attr("deviceId"));
                        }
                        $.jBox.close();

                    });
                }
            });
        }
    </script>
    <!-- 选择美萍号 st -->
    <div colspan="5" id="search_mpno" style="display: none">
        <div class="dialog_content" style="width: 98%">
            <div class="dialog_head_search">
                <input type="text" name="mphName" placeholder="请输入美萍号" size="20" />
                <input type="button" id="btn_mph_search" value="检索" onclick="searchMPH(<%=SeachStoreId %>)" />
            </div>
            <table class="htable">
                <thead>
                    <tr>
                        <th colspan="3">
                            美萍号
                        </th>
                    </tr>
                </thead>
                <tbody id="dialog_mph_tbody">
                    <tr>
                        <td colspan="3" style="text-align: center;">
                            请输入关键字检索
                        </td>
                    </tr>
                </tbody>
            </table>
            <div id="pager">
            </div>
        </div>
    </div>
    <!-- 选择美萍号 ed -->
    <!-- 选择设备号 st -->
    <div colspan="5" id="search_deviceno" style="display: none">
        <div class="dialog_content" style="width: 98%">
            <div class="dialog_head_search">
                <input type="text" name="deviceName" placeholder="请输入设备信息" size="40" />
                <input type="button" id="btn_device_search" value="检索" onclick="DeviceSearch(1)" />
            </div>
            <table class="htable">
                <thead>
                    <tr>
                        <th>
                            设备资产号
                        </th>
                        <th>
                            美萍号
                        </th>
                        <th>
                            调色机型号
                        </th>
                        <th>
                            震荡机型号
                        </th>
                        <th>
                            电脑型号
                        </th>
                    </tr>
                </thead>
                <tbody id="dialog_device_tbody">
                    <tr>
                        <td colspan="9" style="text-align: center;">
                            请输入关键字检索
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <!-- 选择设备号 ed -->
</body>
</html>
